﻿using System.Data;
using UtilsCache;
using UtilsORM;
using UtilsORM.MySqlData;
////using System.Web.Script.Serialization;

namespace GatewayServerService.Data
{
    public class DBIotProductCache
    {



        /// <summary>
        /// 写入mq日志
        /// </summary>
        /// <param name="mQReqModel"></param>
        /// <param name="msg"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public iot_product getProductCache(string pguid)
        {
            //判断产品是否自动运行
            iot_product model = UtilMemoryCacheHelper.get<iot_product>("one_iot_product_" + pguid);//数据太多，报错
            if (model == null)
            {
                EFYihongIotContext ef = new EFYihongIotContext();
                model = ef.iot_product.Where(c => c.p_guid == pguid && c.p_status == 0).FirstOrDefault();
                UtilMemoryCacheHelper.set("one_iot_product_" + pguid, model, 1);
            }
            return model;



        }
    }
}
